import { fliterPermission } from '@/utils/sys.js'
export const apis = {
  list: `/business/transfer/getAll?authCode=FUNCTION_ORDER_ALL`,
  detail: `business/order/detailAll?authCode=BTN_ORDER_DETAIL`,
  getUserList: `/business/user/getUserList?authCode=FUNCTION_ORDER_LIST`,
  
};

export const configs = {
  listUrl: apis.list,
  pageOn: true, // 开启分页
  searchOn: true, // 开启搜索
  operateOn: true, //开启操作区域
  treeOn: false, // 开启树形
  searchMode:'custome',
};


export const searchs = [

  {
    type: "SelectModel",
    column: "user_id",
    label: "用户",
    url:apis.getUserList,
    mapping : {
      label:['user_nick'],
      value: 'id'
    },
    
  },
  {
    type: "SelectModel",
    column: "user_id",
    label: "用户编号",
    url:apis.getUserList,
    mapping : {
      label:['id','user_nick'],
      value: 'id'
    },
   
  },
  {
    type: "SelectModel",
    column: "transfer_mode",
    label: "运输方式",
    modelCode: "MODEL_TRANSPORT_MODE",
    mapping : {
      label:['transport_mode_name'],
      value: 'transport_mode_code'
    }
  },
  {
    type: "SelectModel",
    column: "order_transport_type",
    label: "包裹类型",
    modelCode: "MODEL_TRANSPORT_TYPE",
    mapping : {
      label:['transport_type_name'],
      value: 'transport_type_code'
    }
  },
  {
    type: "Input",
    column: "transfer_no",
    label: "转运单号",
  },
  
  {
    type: "Input",
    column: "outbound_no",
    label: "出库单号",
  },

  {
    type: "Input",
    column: "cabinet_number",
    label: "柜号",
  },

  {
    type: "Input",
    column: "order_logistic_no",
    label: "快递单号",
  },
  {
    type: "Select",
    column: "pay_state",
    label: "支付状态",
    dimCode: "DIM_TRANSFER_PAY_STATE"
  },
  {
    type: "Select",
    column: "order_state",
    label: "订单状态",
    dimCode: "DIM_ORDER_STATE"
  },
  
  {
    type: "SelectModel",
    column: "order_inbound_manage",
    label: "入库员",
    modelCode: "MODEL_BUSINESS_MANAGE",
    mapping : {
      label:['manage_account'],
      value: 'id'
    }
  },

  {
    type: "SelectModel",
    column: "order_outbound_manage",
    label: "出库员",
    modelCode: "MODEL_BUSINESS_MANAGE",
    mapping : {
      label:['manage_account'],
      value: 'id'
    }
  },
  {
    type: "SelectModel",
    column: "address_country",
    label: "目的地",
    modelCode: "MODEL_COUNTRY",
    mapping : {
      label:['country_name'],
      value: 'country_code'
    }
  },
  {
    type: "Input",
    column: "address_name",
    label: "收件人名称",

  },
  {
    type: "Input",
    column: "address_phone",
    label: "收件人手机号",

  },
  {
    type: "DatePicker",
    column: "order_inbound_time",
    label: "入库时间",
  },
  {
    type: "DatePicker",
    column: "order_outbound_time",
    label: "出库时间",
  }
];

export const pages = {
  pageSize: 20,
  orders: [
    {
      field: "id",
      sort: "desc",
    },
  ],
  defaultSearchParam:[]
 
};
export const columns = [
  { type: "selection" },
  // {
  //   label: "ID",
  //   column: "id",
  //   sortable: "custom",
    
  // },

  {
    label: "用户",
    column: "user_id",
    display: "detail",
    format:'model',
    config: {
      mode:'custom', //'default', 默认，custom自定义方式
      component: 'user/components/Mode',
    }
  },
  {
    label: "快递单号",
    column: "order_logistic_no",
  },
  {
    label: "货架号",
    column: "order_shelf_no",
  },
  {
    label: "转运单号",
    column: "transfer_no",
  },
  
  {
    label: "出库单号",
    column: "transfer_outbound_no",
  },
  {
    label: "柜号",
    column: "transfer_cabinet_number",
  },
  {
    label: "运输方式",
    column: "transfer_mode",
    format:'model',
  },
  {
    label: "包裹类型",
    column: "order_transport_type",
    format:'model',
  },
  {
    label: "状态",
    column: "order_state",
    display: "state",
    format:'dim'
  },
  {
    label: "清关状态",
    column: "verify_state",
    display: "state",
    format:'dim'
  },
  {
    label: "支付状态",
    column: "pay_state",
    display: "state",
    format:'dim'
  },
  {
    label: "入库时间",
    column: "order_inbound_time",
    format: "datetime",
    display: "text",
  },
  {
    label: "出库库时间",
    column: "transfer_outbound_time",
    format: "datetime",
    display: "text",
  },
  {
    label: "装柜时间",
    column: "transfer_cabinet_time",
    format: "datetime",
    display: "text",
  },
 {
    label: "派送时间",
    column: "delivery_time",
    format: "datetime",
    display: "text",
  },
 {
    label: "派送方式",
    column: "delivery_type",
    display: "state",
    format:'dim'
  },
  {
    label: "派送备注",
    column: "delivery_remark",
  },
  {
    label: "运输费用",
    column: "transfer_price",
  },
  {
    label: "运输成本",
    column: "transfer_cost",
  },
   {
    label: "利润",
    column: "transfer_cost",
    slot:'profit'
  },
  {
    label: "其他费用",
    column: "transfer_other",
  },
  {
    label: "代理提成",
    column: "transfer_agent_cost",
  },
  {
    label: "创建时间",
    column: "ctime",
    display: "text",
  },
  { label: "操作", column: "operate", width: "240", fixed: "right" },
];

export const buttons = fliterPermission([


]);
export const columnButtons = fliterPermission([
  {
    operate: "detail",
    text: "详情",
    permission: 'BTN_TRANSFER_DETAIL',
  }
 
]);
